<template>
  <el-card>
    <!-- 没有左边的插槽，才会有beginRight这个类 -->
    <div class="card-wrap" :class="{beginRight: !$slots.left}">
      <div v-if="$slots.left" class="left">
        <i class="el-icon-info" />
        <slot name="left" />
      </div>
      <div class="right">
        <slot name="right" />
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  name: 'HeadTool'
}
</script>

<style lang="scss" scoped>
.card-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  &.beginRight{
    flex-direction: row-reverse;
  }

  .left {
    background-color: #e6f7ff;
    border: 1px solid #409eff;
    padding: 5px 10px;
    border-radius: 2px;

    .el-icon-info {
      color: #409eff;
      margin-right:10px;
    }
    .text {
        font-size: 14px;
    }
  }
}
</style>
